﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace intelliEssayHelpAgent
{
	/// <summary>
	/// Interaction logic for MailNotification.xaml
	/// </summary>
	public partial class MailNotification : Window
	{
        bool shouldSend;
		public MailNotification(bool shouldSend)
		{
			this.InitializeComponent();
            SendButton.Click += new RoutedEventHandler(SendButton_Click);
            this.shouldSend = shouldSend;
			// Insert code required on object creation below this point.
		}

        void SendButton_Click(object sender, RoutedEventArgs e)
        {
            if (shouldSend)
            {
                this.Close();
                string receivers = ReceiversTextBox.Text.Trim();
                System.Diagnostics.Process.Start("mailto:" + receivers + "?subject=intelliEssay Build Notification&body=" + MailMessage.Text.Replace("\r","").Replace("\n","%0a"));
            }
        }
	}
}